package io.gitee.tuo_tuo.jfinaldevassistance.controllers;

import com.jfinal.aop.Duang;
import com.jfinal.core.Controller;
import com.jfinal.log.Log;
import io.gitee.tuo_tuo.jfinaldevassistance.common.Rst;
import io.gitee.tuo_tuo.jfinaldevassistance.common.model.User;
import io.gitee.tuo_tuo.jfinaldevassistance.service.UserService;
import io.gitee.tuo_tuo.jfinaldevassistance.validator.Required;

import java.util.List;

public class UserController extends Controller {
	public static Log log = Log.getLog(UserController.class);

	public void index() {
		redirect("/index.html");
	}

	@Required(k = "userId", msg = "userId不能为空")
	public void find(){
		List<User> users = Duang.duang(UserService.class).find();
		renderJson(Rst.ok().setData("users", users));
	}


}
